const app = getApp();
const api = require('../../utils/api.js');
const util = require('../../utils/util.js');
var loginStatus = wx.getStorageSync("loginStatus");
const {
  $Toast
} = require('../../components/base/base');
var p = 0,
  t = 0;
var hasMoreData = true; //阻止重复加载
var IsZiti;
var areaResult = [];
var areaobjResult = {};
var brandsResult = [];
var objResult = {};

Page({

  data: {
    navBg: app.globalData.navBg,
    navColor: app.globalData.navColor,
    windowHeight: app.globalData.windowHeight - app.globalData.navHeight,
    navTop: app.globalData.navHeight,
    back: true,
    navBox: true,
    searchTop: 1,
    searchInput: '请搜索麦德龙商品',
    searchValue: '',
    showView: false,
    arrange: "list",
    isopen: true,
    navCont: 0, //购物车商品数量
    scrollHeight: app.globalData.windowHeight - app.globalData.navHeight - 40,
    itemdetail: [],
    select: 0, //选中
    flag: 2,
    sure: 0,
    sData: [],
    navcataid: '',
    dcid: '',
    nomore: false,
    scrollTop: 0,
    goTop: true,
    goPage: true,
    bnimMin: {},
    bnimList: {},
    bnimLayer: {},
    bnimationWidth: app.globalData.windowWidth * 0.85,
    brandsDialog: false,
    originsDialog: false,
    cateDialog: false,
    showSkeleton: true,
    sortID: 0,
    pageNum: 1, //当前页码
    pageTotal: 0, //总数据
    touchS: [0, 0],
    touchE: [0, 0],
    touch: true,
    loadMore: false,
    loadInfo: false,
    ziti: false,
    fziti: false,
    delivery: '', //配送方式
    kindsIcon: true,
    aniStyle: false, //动画效果，默认slideup
    totalResult: [],
    addressResult: []
  },

  // 切换列表显示方式
  onChangeShowState: function () {
    let that = this;
    if (that.data.isopen) {
      that.setData({
        arrange: "repeat"
      })
    } else {
      that.setData({
        arrange: "list"
      })
    }
    that.data.isopen = !that.data.isopen
    that.setData({
      showView: !that.data.showView
    });

  },

  //点击弹出
  openplus: function () {
    this.bnimationpopp();
  },

  // 配送方式
  radioButtonTap: function (e) {
    var kind = e.currentTarget.dataset.kind;
    if (kind == 0) {
      this.setData({
        ziti: !this.data.ziti,
        fziti: false
      })
      if (this.data.ziti) {
        this.data.delivery = 1
      } else {
        this.data.delivery = ""
      }
    }
    if (kind == 1) {
      this.setData({
        fziti: !this.data.fziti,
        ziti: false
      })
      if (this.data.fziti) {
        this.data.delivery = 0
      } else {
        this.data.delivery = ""
      }
    }

  },

  digitminPrice: function (e) {
    var value = e.detail.value;
    this.setData({
      digitmin: e.detail.value.replace(/^\s+|\s+$/g, '')
    })

  },

  digitmaxPrice: function (e) {
    var value = e.detail.value;
    this.setData({
      digitmax: e.detail.value.replace(/^\s+|\s+$/g, '')
    })

  },

  // 品牌
  checkboxList: function (e) {
    var that = this;
    var index = e.currentTarget.dataset.index;
    var brands = this.data.brands;
    brands[index].checked = !brands[index].checked;
    this.setData({
      brands: brands
    });
  },

  checkboxChange: function (e) {
    var checkValue = e.detail.value;
    var id = []; //选中的ID
    var name = []; //选中的NAME
    //循环选中的数组，取出对应的数据进行数组拼接
    for (var i = 0; i < checkValue.length; i++) {
      var row = checkValue[i].split(",") //将数组进行分割
      id = id.concat(row[0]) //数组下表的第一个为id
      name = name.concat(row[1]) //数组下表的第二个为name
    }
    this.setData({
      brandlist: name.join('、'),
      brandlength: name.length,
      brandItem: id.join(',')
    });

  },

  // 产地
  checkboxArea: function (e) {
    var that = this;
    var index = e.currentTarget.dataset.index;
    var origins = this.data.origins;
    origins[index].checked = !origins[index].checked;
    this.setData({
      origins: origins
    });
  },

  checkboxorigins: function (e) {
    var checkCountry = e.detail.value;
    var id = []; //选中的ID
    var name = []; //选中的NAME
    //循环选中的数组，取出对应的数据进行数组拼接
    for (var i = 0; i < checkCountry.length; i++) {
      var row = checkCountry[i].split(",") //将数组进行分割
      id = id.concat(row[0]) //数组下表的第一个为id
      name = name.concat(row[1]) //数组下表的第二个为name
    }
    this.setData({
      countrylist: name.join('、'),
      countrylength: name.length,
      originItem: id.join(',')
    });

  },

  radioChange: function (e) {
    var that = this;
    var radioValue = e.detail.value;
    var navcataid = that.data.navcataid;
    var id = [];
    var name = [];
    if (radioValue.split(",")[1] == 0) {
      this.setData({
        kindlist: radioValue.split(",")[0],
        navcataid: 0
      })
    } else {
      this.setData({
        kindlist: that.data.kindsCateTitle + " / " + radioValue.split(",")[0],
        navcataid: radioValue.split(",")[1]
      })

    }
    if (radioValue != "" || radioValue != null || radioValue != undefined) {
      that.setData({
        cateDialog: false
      })
    }

  },

  // 分类
  sortCate: function () {
    var that = this;
    that.setData({
      cateDialog: true
    })

  },

  // 分类折叠栏
  changecate: function (e) {
    var that = this;
    if (that.data.aniStyle == true) {
      that.setData({
        aniStyle: false
      })
    } else {
      that.setData({
        aniStyle: true
      })
    }
  },

  // 品牌查更多
  brandsLook: function () {
    var that = this;
    that.setData({
      brandsDialog: true
    })

  },

  // 产地查更多
  originsLook: function () {
    var that = this;
    that.setData({
      originsDialog: true
    })

  },

  formSubmit: function (e) {
    var that = this;
    let digitmin = parseInt(e.detail.value.digitmin);
    let digitmax = parseInt(e.detail.value.digitmax);
    if (digitmin > digitmax) {
      digitmin += digitmax;
      digitmax = digitmin - digitmax;
      digitmin -= digitmax;
      this.setData({
        digitmin: digitmin,
        digitmax: digitmax
      })
    }
    that.data.pageNum = 1
    that.searchItem()
    that.closemin()
  },

  formReset: function (e) {
    var that = this;
    that.data.pageNum = 1;
    that.data.digitmin = 0;
    that.data.digitmax = 0;
    that.resetDelivery()
    that.resetCate()
    that.resetBrand()
    that.resetOrigin()
    that.searchItem()
  },

  //点击收起
  closemin: function () {
    this.tackback();
  },

  //弹出动画
  bnimationpopp: function () {
    var bnimationList = wx.createAnimation({
      duration: 500,
      timingFunction: 'ease-out'
    })
    var bnimationLayer = wx.createAnimation({
      duration: 10,
      timingFunction: 'ease-out'
    })

    bnimationList.translate(-this.data.bnimationWidth, 0).opacity(1).step();
    bnimationLayer.width(wx.getSystemInfoSync().windowWidth).opacity(1).step();

    this.setData({
      bnimList: bnimationList.export(),
      bnimLayer: bnimationLayer.export()
    })
  },

  //收回动画
  tackback: function () {
    var bnimationList = wx.createAnimation({
      duration: 500,
      timingFunction: 'ease-out'
    })
    var bnimationLayer = wx.createAnimation({
      duration: 10,
      timingFunction: 'ease-out'
    })
    bnimationList.translate(0, 0).opacity(0).step();
    bnimationLayer.width(0).opacity(0).step();
    this.setData({
      bnimList: bnimationList.export(),
      bnimLayer: bnimationLayer.export(),
      brandsDialog: false,
      originsDialog: false,
      cateDialog: false
    })
  },

  // 清除配送方式
  resetDelivery: function () {
    var that = this;
    this.setData({
      fziti: false,
      ziti: false
    })
    this.data.delivery = ""
  },

  // 清除分类
  resetCate: function () {
    var that = this;
    var kindsCate = this.data.kindsCate;
    for (var i = 0; i < kindsCate.length; i++) {
      kindsCate[i].kindsCate = false
    }
    that.setData({
      kinds: [{
        "ID": 0,
        "Name": "全部分类",
        "checked": false
      }]
    })

    that.setData({
      kindsCate: kindsCate,
      kindlist: '',
      navcataid: that.data.$navcataid
    })
  },

  // 清除价格区间
  resetPrice: function () {
    that.data.digitmin = 0;
    that.data.digitmax = 0;
  },

  // 清除品牌
  resetBrand: function () {
    var that = this;
    var brands = this.data.brands;
    for (var i = 0; i < brands.length; i++) {
      brands[i].checked = false
    }

    that.setData({
      brands: brands,
      brandlength: '',
      brandlist: ''
    })
    that.data.brandItem = '';
  },

  // 清除产地
  resetOrigin: function () {
    var that = this;
    var origins = this.data.origins;
    for (var i = 0; i < origins.length; i++) {
      origins[i].checked = false
    }
    that.setData({
      origins: origins,
      countrylength: '',
      countrylist: ''
    })
    that.data.originItem = '';
  },

  //关闭二级弹层
  closeSec: function () {
    var that = this;
    that.setData({
      brandsDialog: false,
      originsDialog: false,
      cateDialog: false
    })
  },

  //关键词搜索
  searchItem: function () {
    var that = this;
    var searchValue = that.data.searchValue; //关键词
    var navcataid = that.data.navcataid; //列表id
    var dcid = that.data.dcid; //分类id
    var sortID = that.data.sortID; //排序号
    var pageNum = that.data.pageNum; //当前页码
    var delivery = that.data.delivery; //是否自提
    that.setData({
      nomore: false
    })

    wx.request({
      url: util.api + api.SearchProduct,
      data: {
        BUSINESS_PARAMETERS: {
          userToekn: loginStatus.token,
          PostStaId: 22,
          combo: 0,
          cid: navcataid,
          keyword: searchValue,
          sort: sortID,
          pageNo: pageNum,
          brandIds: that.data.brandItem,
          origin: that.data.originItem,
          IsZiti: delivery,
          minprice: that.data.digitmin,
          maxprice: that.data.digitmax,
          first: true
        },
        SYSTEM_PARAMETERS: {
          APP_ID: "M_P_G001",
          METHOD_ID: 0,
          ACCESS_TOKEN: "1w2Re3bE^og38",
          TIMESTAMP: util.formatTime(new Date(), 'Y/M/D h:m:s'),
          SIGN: "string"
        }
      },
      method: 'POST',
      header: {
        'Content-Type': 'application/json'
      },
      success: function (res) {

        if (res.statusCode == 200) {
          if (res.data.MESSAGE.MESSAGE_CODE == 1) {
            console.log(res.data.RESULT)
            var lily = that.data.itemdetail;
            var pageSize = res.data.RESULT['<ProductList>k__BackingField']['<PageSize>k__BackingField']; //每页固定数据
            that.setData({
              totalResult: res.data.RESULT
            })
            // 分类
            if (navcataid != "" || navcataid != null || navcataid != undefined || navcataid.length != 0) {
              that.setData({
                kinds: [{
                  "ID": 0,
                  "Name": "全部分类",
                }]
              })
              wx.request({
                url: util.api + api.GetChannelList,
                data: {
                  BUSINESS_PARAMETERS: {
                    userToekn: loginStatus.token,
                    PostStaId: 22
                  },
                  SYSTEM_PARAMETERS: {
                    APP_ID: "M_P_G001",
                    METHOD_ID: 0,
                    ACCESS_TOKEN: "1w2Re3bE^og38",
                    TIMESTAMP: util.formatTime(new Date(), 'Y/M/D h:m:s'),
                    SIGN: "string"
                  }
                },
                method: 'POST',
                header: {
                  'Content-Type': 'application/json'
                },
                success: function (str) {
                  if (str.statusCode == 200) {
                    if (str.data.MESSAGE.MESSAGE_CODE == 1) {
                      for (var i = 0; i < str.data.RESULT.length; i++) {
                        for (var j = 0; j < str.data.RESULT[i].NavCata.length; j++) {
                          if (str.data.RESULT[i].NavCata[j]['<NavCataID>k__BackingField'] == dcid) {
                            that.setData({
                              kindsCateTitle: str.data.RESULT[i].NavCata[j]['<NavCataName>k__BackingField']
                            })
                            str.data.RESULT[i].NavCata[j].checked = true;
                          }
                        }
                      }

                    }
                  }
                },
                fail: function (str) {

                },
                complete: function (str) {

                }
              })

              wx.request({
                url: util.api + api.LoadCate,
                data: {
                  BUSINESS_PARAMETERS: {
                    userToekn: loginStatus.token,
                    cid: navcataid
                  },
                  SYSTEM_PARAMETERS: {
                    APP_ID: "M_P_G001",
                    METHOD_ID: 0,
                    ACCESS_TOKEN: "1w2Re3bE^og38",
                    TIMESTAMP: util.formatTime(new Date(), 'Y/M/D h:m:s'),
                    SIGN: "string"
                  }
                },
                method: 'POST',
                header: {
                  'Content-Type': 'application/json'
                },
                success: function (obj) {
                  if (obj.statusCode == 200) {
                    if (obj.data.MESSAGE.MESSAGE_CODE == 1) {
                      var kindsAll = [];
                      for (var i = 0; i < obj.data.RESULT.length; i++) {
                        kindsAll.push(obj.data.RESULT[i])
                      }
                      that.setData({
                        kindsCate: kindsAll
                      })
                      kindsAll.checked = true;
                    }
                  }
                },
                fail: function (obj) {

                },
                complete: function (obj) {

                }
              })

            } else {
              that.setData({
                kinds: [{
                  "ID": 0,
                  "Name": "全部分类",
                }]
              })
            }

            // 品牌 (去重)
            for (var i = 0; i < res.data.RESULT['<Brands>k__BackingField'].length; i++) {
              if (!objResult[res.data.RESULT['<Brands>k__BackingField'][i]['<Key>k__BackingField']]) {
                brandsResult.push(res.data.RESULT['<Brands>k__BackingField'][i]);
                objResult[res.data.RESULT['<Brands>k__BackingField'][i]['<Key>k__BackingField']] = true;
              }
            }
            console.log(brandsResult)
            
            that.setData({
              brands: brandsResult
            })

            // 产地 (去重)
            for (var i = 0; i < res.data.RESULT['<Origins>k__BackingField'].length; i++) {
              if (!areaobjResult[res.data.RESULT['<Origins>k__BackingField'][i]['<Key>k__BackingField']]) {
                areaResult.push(res.data.RESULT['<Origins>k__BackingField'][i]);
                areaobjResult[res.data.RESULT['<Origins>k__BackingField'][i]['<Key>k__BackingField']] = true;
              }
            }
            
            that.setData({
              origins: areaResult
            })
           

            if (pageNum == 1) { //初始化数据列表
              lily = []
            }
            var itemdetail = res.data.RESULT['<ProductList>k__BackingField']['<List>k__BackingField'];
            //请求的数据追加到原始数据集合里
            // 如果当前数据小于每页固定数据，则终止请求
            if (itemdetail.length < pageSize) {
              // 若页面无数据
              if (itemdetail == null || itemdetail == undefined || itemdetail == "" || itemdetail.length == 0) {
                that.setData({
                  loadMore: true
                })
              } else {
                that.setData({
                  loadMore: false
                })
              }
              hasMoreData = false
              that.setData({
                itemdetail: lily.concat(itemdetail),
                loadInfo: false,
                nomore: false,
              })
            } else { // 如果当前数据大于每页固定数据，则页码加一继续请求
              that.setData({
                loadMore: false
              })
              hasMoreData = true
              that.setData({
                itemdetail: lily.concat(itemdetail),
                loadInfo: true,
                nomore: false,
                pageNum: that.data.pageNum + 1
              })

            }
            that.setData({
              showSkeleton: false
            })

          }
          if (res.data.MESSAGE.MESSAGE_CODE == 0) {
            $Toast({
              content: '接口异常!',
              icon: 'prompt_fill',
              duration: 1
            });
          }
        }
      },
      fail: function (res) {},
      complete: function (res) {}
    })
  },


  //综合排序
  comprehensive: function () {
    var that = this;
    that.setData({
      select: 0,
      flag: 2,
      sortID: 0,
      scrollTop: 0,
      showSkeleton: true
    })
    that.data.pageNum = 1;
    that.searchItem();
  },

  //价格排序
  priceSort: function (e) {
    var that = this;
    var sel = e.currentTarget.dataset.sel;
    if (sel == 1) {
      if (that.data.flag = !that.data.flag) {
        that.setData({
          flag: 1,
          sortID: 3
        })
      } else {
        that.setData({
          flag: 0,
          sortID: 4
        })
      }
      that.setData({
        select: 1,
        scrollTop: 0
      })
    }
    that.setData({
      showSkeleton: true
    })
    that.data.pageNum = 1;
    that.searchItem();
  },

  //销量排序
  salesVolume: function (e) {
    var that = this;
    var sel = e.currentTarget.dataset.sel;
    if (sel == 2) {
      if (that.data.sure = !that.data.sure) {
        that.setData({
          sure: 1,
          sortID: 6
        })
      } else {
        that.setData({
          sure: 0,
          sortID: 6
        })
      }
      that.setData({
        select: 2,
        flag: 2,
        scrollTop: 0
      })
    }
    that.setData({
      showSkeleton: true
    })
    that.data.pageNum = 1;
    that.searchItem();
  },

  // 品牌 (去重)
  brandsResult: function () {
    var that = this;
    var totalResult = that.data.totalResult;
    var brandsResult = [];
    var objResult = {};
    for (var i = 0; i < totalResult['<Brands>k__BackingField'].length; i++) {
      if (!objResult[totalResult['<Brands>k__BackingField'][i]['<Key>k__BackingField']]) {
        brandsResult.push(totalResult['<Brands>k__BackingField'][i]);
        objResult[totalResult['<Brands>k__BackingField'][i]['<Key>k__BackingField']] = true;
      }
    }
    console.log(totalResult)
    that.setData({
      brands: brandsResult
    })
    for (let i; i < totalResult['<Brands>k__BackingField'].length; i++) {
      totalResult['<Brands>k__BackingField'][i].checked = true;
      console.log(totalResult['<Brands>k__BackingField'][i])
    }
  },

  // 产地 (去重)
  areaResult: function () {
    var that = this;
    var totalResult = that.data.totalResult;
    var areaResult = [];
    var areaobjResult = {};
    for (var i = 0; i < totalResult['<Origins>k__BackingField'].length; i++) {
      if (!areaobjResult[totalResult['<Origins>k__BackingField'][i]['<Key>k__BackingField']]) {
        areaResult.push(totalResult['<Origins>k__BackingField'][i]);
        areaobjResult[totalResult['<Origins>k__BackingField'][i]['<Key>k__BackingField']] = true;
      }
    }
    that.setData({
      origins: areaResult
    })
    for (let i; i < totalResult['<Origins>k__BackingField'].length; i++) {
      totalResult['<Origins>k__BackingField'][i].checked = true;
    }
  },

  // 返回顶部显隐
  scroll: function (e) {
    var that = this;
    var listIndex = (e.detail.scrollTop + this.data.screenHeight) / (this.data.screenWidth * 0.4)

    if (e.detail.scrollTop > app.globalData.navHeight + 40) {
      this.setData({
        listIndex: listIndex
      });
      if (that.data.touch) {
        this.setData({
          goTop: false
        });
      }
    } else {
      this.setData({
        goTop: true
      });
    }

  },

  //返回顶部
  goScrolltop: function (e) {
    var that = this;
    var top = that.data.scrollTop;
    if (top == 1) {
      top = 0;
    } else {
      top = 1;
    }
    that.setData({
      scrollTop: top
    })

  },

  // 上滑到底部
  bindscrolltolower: function (e) {
    var that = this;
    if (hasMoreData) {
      that.searchItem();
      that.setData({
        loadInfo: false,
        nomore: false
      })
    } else {
      that.setData({
        nomore: true
      })

    }
  },

  // 加入购物车
  addCart: function (e) {
    var that = this;
    var itemdetails = that.data.itemdetail;
    var pid = e.currentTarget.dataset.id;
    var id = [];
    id.push(pid)
    that.cartNumber();

    wx.request({
      url: util.api + api.AddOrModCart,
      data: {
        BUSINESS_PARAMETERS: {
          userToekn: loginStatus.token,
          PostStaId: 22,
          ProductIDs: id,
          nums: [1],
          plus: true
        },
        SYSTEM_PARAMETERS: {
          APP_ID: "M_P_G001",
          METHOD_ID: 0,
          ACCESS_TOKEN: "1w2Re3bE^og38",
          TIMESTAMP: util.formatTime(new Date(), 'Y/M/D h:m:s'),
          SIGN: "string"
        }
      },
      method: 'POST',
      header: {
        'Content-Type': 'application/json'
      },
      success: function (res) {
        $Toast({
          content: "加入购物车成功!",
          icon: 'success',
          duration: 1
        });

      },
      fail: function (res) {}

    })

  },

  //页面加载时购物车数量
  countCart: function (e) {
    var that = this;
    wx.request({
      url: util.api + api.GetShopcart,
      data: {
        BUSINESS_PARAMETERS: {
          userToekn: loginStatus.token,
          PostStaId: 22
        },
        SYSTEM_PARAMETERS: {
          APP_ID: "M_P_G001",
          METHOD_ID: 0,
          ACCESS_TOKEN: "1w2Re3bE^og38",
          TIMESTAMP: util.formatTime(new Date(), 'Y/M/D h:m:s'),
          SIGN: "string"
        }
      },
      method: 'POST',
      header: {
        'Content-Type': 'application/json'
      },
      success: function (res) {
        if (res.data.MESSAGE.MESSAGE_CODE == 1) {
          var arr = res.data.RESULT || [];
          var counts = 0;
          //遍历购物车对其进行求和
          for (var i = 0; i < arr.length; i++) {
            counts = parseInt(counts) + parseInt(arr[i].Num);
          }
          let navCont = that.data.navCont;
          //购物车商品数量
          that.setData({
            navCont: counts
          })
        }

      },
      fail: function (res) {}
    })
  },

  //加入购物车实时数量
  cartNumber: function () {
    var that = this;
    wx.request({
      url: util.api + api.GetShopcart,
      data: {
        BUSINESS_PARAMETERS: {
          userToekn: loginStatus.token,
          PostStaId: 22
        },
        SYSTEM_PARAMETERS: {
          APP_ID: "M_P_G001",
          METHOD_ID: 0,
          ACCESS_TOKEN: "1w2Re3bE^og38",
          TIMESTAMP: util.formatTime(new Date(), 'Y/M/D h:m:s'),
          SIGN: "string"
        }
      },
      method: 'POST',
      header: {
        'Content-Type': 'application/json'
      },
      success: function (res) {
        if (res.data.MESSAGE.MESSAGE_CODE == 1) {
          var arr = res.data.RESULT || [];
          var counts = 1;
          //遍历购物车对其进行求和
          for (var i = 0; i < arr.length; i++) {
            counts = parseInt(counts) + parseInt(arr[i].Num);
          }
          let navCont = that.data.navCont;
          //购物车商品数量
          that.setData({
            navCont: counts
          })
        }

      },
      fail: function (res) {}
    })
  },

  gotoDetail: function (e) {
    var that = this;
    var id = e.currentTarget.dataset.id;
    var navcataid = that.data.navcataid;
    util.navigateTo('../productdetail/productdetail?id=' + id + '&navcataid=' + navcataid)
  },

  toShop: function () {
    util.navigateTo('../cart/cart')
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    try {
      var search = options.search;
      var navcataid = options.navcataid;
      var dcid = options.dcid;
      that.setData({
        searchValue: search,
        navcataid: navcataid,
        $navcataid: navcataid,
        dcid: dcid
      })
    } catch (e) {
      console.log(e)
    }
    that.searchItem();

    //获取屏幕尺寸
    const screenWidth = wx.getSystemInfoSync().windowWidth;
    const screenHeight = wx.getSystemInfoSync().windowHeight;
    this.setData({
      listIndex: screenHeight / (screenWidth * 0.4),
      screenWidth: screenWidth,
      screenHeight: screenHeight
    })

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    this.countCart()
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  }


})